package com.ordobill.webapp.common;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import javax.imageio.ImageIO;


public class Thumbnail {

	public Thumbnail() {}
	
	public static void createImage(String loadFile, String saveFile) 
		throws IOException {
		
		FileInputStream fs = new FileInputStream(loadFile);

		BufferedImage img = ImageIO.read(fs);

		int width = 80;
		int height = 105;

		BufferedImage thumb = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
		Graphics2D g2 = thumb.createGraphics();

		g2.drawImage(img, 0, 0, width, height, null);

		File save = new File(saveFile);
		ImageIO.write(thumb, "png", save);
	}
}
